package com.monkey.algorithm.chapter1

/**
 * 作者：Monkey
 * 日期：2018/1/28
 */
object ThreeSum {
    fun count(list: List<Int>): Int {
        val length = list.size
        var count = 0
        for (i in 0 until length) {
            for (j in (i + 1) until length) {
                for (k in (j + 1) until length) {
                    if ((list[i] + list[j] + list[k]) == 0) {
                        count++
                    }
                }
            }
        }
        return count
    }
}